<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        body{
            height: 2000px;
        }
        .img{
            width: 500px;
            height: 900px;
            background-color: brown;
        }
    </style>
</head>
<body>
    <div class="img"></div>
    <script>
        $(window).scroll(function(){
            var H = $(window).scrollTop();
            console.log(H);
        })
    </script>
</body>
</html>